package com.xbongbong.saas.domain.entity;/*/*/

import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.paas.toolbox.wrap.Entity;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 标签
 * @author 魏荣杰
 * @date 2019/2/27 11:17
 * @since v1.0
 * @version v1.0
 */
@Setter
@Getter
@ToString
public class TagLinkEntity extends Entity {
    private static final long serialVersionUID = -5845109061398915058L;
    /**
     * 主键ID
     */
    private Integer id;
    /**
     * 公司ID
     */
    private String corpid;
    /**
     * 打标签或所属的用户id
     */
    private String userId;
    /**
     * 标签id
     */
    private Integer tagId;
    /**
     * 冗余tb_tag表的标签类型：如公海规则等，参考TagEnum
     */
    private Integer tagType;
    /**
     * 对象id
     */
    private Long refId;
    /**
     * 对象类型，参考XbbRefTypeEnum
     */
    private Integer refType;
    /**
     * 标签备注信息
     */
    private String memo;
    /**
     * 添加时间
     */
    private Long addTime;

    public TagLinkEntity() {
        this.addTime = DateTimeUtil.getInt();
    }

    public TagLinkEntity(String corpid, String userId, TagEntity tag, Long refId, XbbRefTypeEnum refTypeEnum, String memo) {
        this();
        this.corpid = corpid;
        this.userId = userId;
        this.tagId = tag.getId();
        this.tagType = tag.getTagType();
        this.refId = refId;
        this.refType = refTypeEnum.getCode();
        this.memo = memo;
    }
}
